#include <cstdio>

int n, k, qtd, i, j, s;
int kx[1001];
int tab[10001];

void read(){
	for(i=1;i<n;i++)tab[i]=0;
	for(i=0;i<k;i++)scanf("%d", &kx[i]);
	
}
int min(int a, int b){
	return a<b?a:b;
}
bool process(){
	for(i=0;i<k;i++){
		for(j=kx[i];j<n;j++){
			if(j%kx[i] == 0){
				if(tab[j])tab[j] = min(tab[j], j/kx[i]);
				else tab[j]=j/kx[i];
			}
			else if(j-kx[i]>0){
				if(tab[j-kx[i]]){
					if(tab[j])tab[j] = min(tab[j], tab[j-kx[i]]+tab[j - j%kx[i]]);
					else tab[j]=tab[j-kx[i]]+tab[j - j%kx[i]];
				}
				
			}
		}
	}
	
	for(i=n-1;i>0;i--){
		if(tab[i]==n-i){
			qtd=n-i;
			return true;
		}
	}
	return false;
}

int main(){
	freopen("L4QD.in","r",stdin);
	freopen("L4QD.out","w",stdout);
	int x=1;
	
	while(scanf("%d %d", &n, &k)==2){
		read();
		if(process())	printf("Caso #%d: %d %d\n", x++, n-qtd, qtd);
		else 			printf("Caso #%d: Impossivel\n", x++);
	}
}
